from selenium.webdriver.common.by import By

from ecshop.base.Base import Base


class GoodsListPage(Base):
    def __init__(self, driver):
        Base.__init__(self, driver)

    def into_menu_frame(self):
        self.into_frame('menu-frame')

    def click_goods_link(self):
        self.click((By.LINK_TEXT,'商品列表'))

    def out_menu_frame(self):
        self.out_frame()

    def into_main_frame(self):
        self.into_frame('main-frame')

    def input_keyword(self):
        self.input((By.NAME,'keyword'),'N85')

    def click_search_button(self):
        self.click((By.XPATH,'//input[@value=" 搜索 "]'))

    def select_by_type(self):
        self.select_by_text((By.NAME,'intro_type'),'新品')

    def input_goods_name(self):
        self.input((By.NAME,'goods_name'),'DiorN85999')

    def select_category(self):
        self.select_by_text((By.NAME,'cat_id'),'奥特曼')

    def click_submit(self):
        self.click((By.XPATH,'//input[@value=" 确定 "]'))

    def click_add_goods_link(self):
        self.click((By.LINK_TEXT,'添加新商品'))

    def click_is_not_sales(self):
        self.click((By.XPATH,'//img[@src="images/yes.gif"]'))